package com.fanix5.javamvvm.utils;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;

import com.blankj.utilcode.util.BarUtils;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;

public class StatusBarUtil {

    private static StatusBarUtil mInstance;


    public static StatusBarUtil getInstance() {

        if(mInstance == null){
            synchronized (StatusBarUtil.class){
                if(mInstance == null){
                    mInstance = new StatusBarUtil();
                }
            }
        }

        return mInstance;
    }

    public void setBar(Activity activity, View view,boolean lightColor){
        QMUIStatusBarHelper.translucent(activity);
        if (lightColor){
            //黑色
            QMUIStatusBarHelper.setStatusBarLightMode(activity);
        }else{
            //白色
            QMUIStatusBarHelper.setStatusBarDarkMode(activity);
        }

        ViewGroup.LayoutParams params = view.getLayoutParams();
        params.height = BarUtils.getStatusBarHeight();

    }


}
